package com.netease.financial.ui.dialog;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.view.Window;

import com.netease.financial.R;

/**
 * Created by wyf on 6/24/15.
 */
public class BottomDialog extends Dialog {
    private Context mContext;

    public BottomDialog(Context context) {
        super(context, R.style.bottom_dialog);
        mContext = context;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        init();
    }

    @Override
    public void setContentView(View view) {
        int screenWidth = mContext.getResources().getDisplayMetrics().widthPixels;
        view.setMinimumWidth(screenWidth);
        super.setContentView(view);
    }

    private void init() {

        Window window = getWindow();
        // 设置位置
        window.setGravity(Gravity.BOTTOM);

//        setContentView(view);
        setCancelable(true);
        setCanceledOnTouchOutside(true);
    }
}
